package day17.myRelect2;

import java.lang.reflect.Constructor;

public class RelectDemo1 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
       // method2();
        //method1();
        //method3();
        //method4();


    }

    private static void method4() throws ClassNotFoundException, NoSuchMethodException {
        Class clazz = Class.forName("day17.myRelect2.Student");
        Constructor constructor = clazz.getDeclaredConstructor(String.class);
        System.out.println(constructor);
    }

    private static void method3() throws ClassNotFoundException, NoSuchMethodException {
        Class clazz = Class.forName("day17.myRelect2.Student");
        Constructor constructor1 = clazz.getConstructor();
        System.out.println(constructor1);

        Constructor constructor2 =  clazz.getConstructor(String.class, int.class);
        System.out.println(constructor2);
    }

    private static void method1() throws ClassNotFoundException {
        Class clazz = Class.forName("day17.myRelect2.Student");
        Constructor[] constructors1=clazz.getConstructors();
        for (Constructor constructor : constructors1) {
            System.out.println(constructor);
        }
    }

    private static void method2() throws ClassNotFoundException {
        Class clazz = Class.forName("day17.myRelect2.Student");
        Constructor[] constructors2 = clazz.getDeclaredConstructors();
        for (Constructor constructor : constructors2) {
            System.out.println(constructor);

        }
    }


}
